package com.wuyu.mini.spring;

import com.wuyu.mini.spring.ioc.MiniBeanInjector;
import com.wuyu.mini.spring.ioc.factory.MiniBeanFactory;

/**
 * @author Administrator
 */
public class AnnotationApplicationContext {

    private MiniBeanFactory factory = null;

    public AnnotationApplicationContext(String pack) {
        factory = MiniBeanFactory.MiniBeanFactoryHolder.SINGLETON.getInstance();
        factory.loadBeans(pack);
        //注入
        MiniBeanInjector injector = new MiniBeanInjector();
        injector.doIoc();
    }

    public Object getBean(Class<?> clazz){
        return factory.getBean(clazz);
    }
}
